package com.meizhi.toystory;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;

import java.util.*;


@SpringBootApplication
@RestController
@EnableAutoConfiguration
public class DemoApplication {

    // main函数，Spring Boot程序入口
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    // 根目录映射 Get访问方式 直接返回一个字符串
    @RequestMapping("/")
    Map<String, String> hello() {
        Map<String, String> map = new HashMap<String, String>();
        map.put("content", "hello freewolf~");
        return map;
    }
}


//@RestController
//class UserController {
//
//    // 路由映射到/users
//    @RequestMapping(value = "/users", produces = "application/json;charset=UTF-8")
//    @RolesAllowed("check")
//    public String usersList() {
//
//        ArrayList<String> users = new ArrayList<String>() {{
//            add("freewolf");
//            add("tom");
//            add("jerry");
//        }};
//
//        return JSONResult.fillResultString(0, "", users);
//    }
//
//    @RequestMapping(value = "/hello", produces = "application/json;charset=UTF-8")
//    public String hello() {
//        ArrayList<String> users = new ArrayList<String>() {{
//            add("hello");
//        }};
//        return JSONResult.fillResultString(0, "", users);
//    }
//
//    @RequestMapping(value = "/world", produces = "application/json;charset=UTF-8")
//    public String world() {
//        ArrayList<String> users = new ArrayList<String>() {{
//            add("world");
//        }};
//        return JSONResult.fillResultString(0, "", users);
//    }
//}

